<?php


namespace App\Models;


class Version extends BaseModel
{
    CONST TYPE = [
        'ios' => 'ios',
        'android' => 'android'
    ];

    protected $table = 'app_version';

    public static function getVersionByType($type)
    {
        $where = [
            ['type', '=', $type],
            ['status', '=', 1],
        ];
        $version = self::where($where)->first();
        if ($version) {
            $version = $version->toArray();
            $version['path'] = self::jsonDecodeImg($version['path']);
        } 
        return $version?:[];
    }
}